#! /bin/bash
. ./env.sh

# --- main ---

update_k8s() {

  for s in ${Host}; do
    sshpass -p $password scp env.sh root@$s:/root/
    echo $s '环境变量拷贝'

    sshpass -p $password ssh root@$s "bash -s" <systemd_stop.sh
    echo $s '停止服务'

    sshpass -p $password scp $SYSTEM_NAME root@$s:$BIN_DIR
    echo $s '更新文件'

    sshpass -p $password ssh root@$s "bash -s" <systemd_start.sh
    echo $s '启动服务'

  done

}

update_k8s
rm -rf ${REPO}
